
<!DOCTYPE html>
<html>

<head>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>出诊时间</title>
    <link rel="shortcut icon" href="favicon.ico"> <link href="../../plugins/bootstrap/css/bootstrap.css" rel="stylesheet">
    <link href="../../css/font-awesome.css?v=4.4.0" rel="stylesheet">

    <link href="../../plugins/iCheck/custom.css" rel="stylesheet">

    <link href="../../plugins/fullcalendar/fullcalendar.css" rel="stylesheet">
    <link href="../../plugins/fullcalendar/fullcalendar.print.css" rel="stylesheet">

    <link href="../../css/animate.css" rel="stylesheet">
    <link href="../../css/style.css?v=4.1.0" rel="stylesheet">

</head>

<body class="gray-bg">

<div class="wrapper wrapper-content" style="width: 900px;margin-left: 280px;">
    <div class="row animated fadeInDown">
        <div class="col-sm-9">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>排班日期</h5>

                </div>
                <div class="ibox-content">
                    <div id="calendar"></div>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script src="../../plugins/jquery/jquery.min.js"></script>
<script src="../../plugins/bootstrap/js/bootstrap.min.js"></script>
<!-- 自定义js -->
<script src="../../js/content.js"></script>
<script src="../../js/jquery-ui.custom.min.js"></script>
<!-- iCheck -->
<script src="../../js/icheck.min.js"></script>
<!-- Full Calendar -->
<script src="../../js/fullcalendar.min.js"></script>

<script>
    var url = location.search;

    var obj = {};
    var reg = /\?/;
    if (url.match(reg)) {
        //判断传入参数，以问号截取，问号后是参数
        var chars = url.split('?')[1];

        //再截&号
        var arr = chars.split('&');

        //获得截取后的数组为键值对字符串
        for (var i = 0; i < arr.length; i++) {

            //保守一点确定看是否为 name=value形式
            var num = arr[i].indexOf("=");

            if (num > 0) {
                //拼接字符串
                var name = arr[i].substring(0, num);
                var value = arr[i].substr(num + 1);

                //拼接对象，并转码
                obj[decodeURIComponent(name)] = decodeURIComponent(value);
            }
        }
    }

</script>

<script>
    $(document).ready(function () {

        /* initialize the calendar
         -----------------------------------------------------------------*/
        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();

        $('#calendar').fullCalendar({
            header: {
                left: 'prev,next',
                center: 'title',
                right: 'today'
            },
            lang: 'zh-cn',
            buttonIcons: false, // show the prev/next text
            weekMode: 'liquid',
            events: function(start,end,callback) {
                $.ajax({
                    url: "/treatment/timeCount?docId="+obj.doctorId,
                    dataType: 'json',
                    success: function(result) { // 获取当前月的数据
                        var events = [];
                        $.each(result.data, function (i, c) {
                            events.push({
                                title: '该日挂号数' + c.counts,
                                start: c.years, // will be parsed
                                color: 'green'
                            });
                        });
                        callback(events);
                    }
                });

            }
        });

    })
</script>


</body>

</html>